package com.holyant.report.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Objects;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RptSaleSummaryDto {
    private ErrorOrderDto errorOrderDto;
    private SaleSummary cbSummary;
    private SaleSummary wmSummary;

    @Data
    public static class ErrorOrderDto {
        private Integer orderTotal;
        private Integer goodsQtyTotal;
        private Integer noInventoryTotal;
        private Integer goodsInfoErrorTotal;
        private Integer declarationErrorTotal;
        private Integer otherTotal;
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class SaleSummary {
        private Integer customerTotal;
        private Integer orderTotal;
        private Integer goodsTotal;
        private List<SaleDetail> details;
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class SaleDetail implements Comparable<SaleDetail> {
        private String channel;
        private Integer customer;
        private Integer order;
        private Integer goods;

        @Override
        public int compareTo(SaleDetail o) {
            return Objects.compare(channel, o.channel, String::compareTo);
        }
    }
}
